package com.ruoyi.pms.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.pms.common.ResponseResult;
import com.ruoyi.pms.domain.vo.CustomerVO;
import com.ruoyi.pms.domain.vo.TaskUserDetailVO;
import com.ruoyi.pms.domain.vo.TaskUserVO;
import com.ruoyi.pms.dto.task.*;
import com.ruoyi.pms.service.TaskService;
import com.ruoyi.pms.service.imp.TaskReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/pms/taskreport")
public class TaskReportController extends BaseController {


    @Autowired
    TaskService taskService;

    @Autowired
    TaskReportService taskReportService;

    @GetMapping("/list")
    @ResponseBody
    public TableDataInfo list(TaskUserVO taskUserVO) throws Exception {
        startPage();
        List<TaskUserVO> list = taskReportService.selectUserTasksPage(taskUserVO);
        return getDataTable(list);
    }

    @GetMapping("/listTask")
    @ResponseBody
    public AjaxResult listTask(TaskUserDetailVO taskUserVO) throws Exception {
//        startPage();
        List<TaskUserDetailVO> list = taskReportService.selectUserTasksDetailPage(taskUserVO);
        return AjaxResult.success(list);
    }
}
